package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * 对象流:处理流/高级流---ObjectInputStream和ObjectOutputStream
 * 1）
 */
public class OOSDemo {
    public static void main(String[] args) throws IOException {
       String name="张三";
       int age=25;
       String gender="男";
       String[] otherInfo={"是学生","黑龙江佳木斯的","喜欢打篮球"};
       Student zs=new Student(name,age,gender,otherInfo);
       System.out.println(zs);
        /**
         * 对象输出流在序列化对象时，必须保证序列化对象实现了Serializable接口
         */
        FileOutputStream fos=new FileOutputStream("student.obj");
        ObjectOutputStream oos=new ObjectOutputStream(fos);
        oos.writeObject(zs);
        System.out.println("写出完毕");
        oos.close();
    }
}
